package com.yq.leetcodeOld.tree;

/**
 * @ClassName SingleLinkedList
 * @Description TODO
 * @Author yaoqiang
 * @Date 2022/2/18 14:22
 * @Version 1.0
 */
public class SingleLinkedList {
    ListNode head=new ListNode(0);

    public void add(ListNode node){
        ListNode temp=head;
        while (true){
            if(temp.next==null){
                break;
            }
            temp=temp.next;
        }
        head.next=node;
    }
    public void list(){
        ListNode temp=head.next;
        while (true){
            if(temp==null){break;}
            System.out.println(temp);
            temp=temp.next;
        }
    }
}
